import axios from 'axios'
import baseUrl from '../../util/url.js'
const url = baseUrl + 'api.php/records/detail'
export default {
    namespaced: true,
    state: {
        list: [],
        total: 0,
        pagesize:0
    },
    mutations: {},
    actions: {
        getAllgoods({ state, commit, dispatch }, currentPage) {
            return new Promise((resolve, reject) => {
                axios({
                    method: 'get',
                    url,
                    params: { transform: 1 , order: 'id,desc', page: `${currentPage},6`,}
                }).then(res => {
                    state.list = res.data.records
                    state.total = res.data.results
                    state.pagesize= Math.ceil( state.total/6)
                }).catch(e => {
                    reject()
                })
            });
        }
    }

}